﻿using FeatureDemo.Helper;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System;
using System.Linq;

namespace FeatureDemo.Features.LiveTiles
{
    [Feature("Update", "How to update a Live Tile", 7.5)]
    public partial class UpdatePage : PhoneApplicationPage
    {
        public UpdatePage()
        {
            InitializeComponent();
        }

        private void _update_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            Random rnd = new Random();
            StandardTileData data = new StandardTileData
            {
                Title = _text.Text,
                Count = rnd.Next(100)
            };

            ShellTile defaultTile = ShellTile.ActiveTiles.First();
            defaultTile.Update(data);

        }
    }
}